import { defineConfig } from "vite";
import vue from "@vitejs/plugin-vue";
import AutoImport from "unplugin-auto-import/vite";
import Components from "unplugin-vue-components/vite";
import { ArcoResolver } from "unplugin-vue-components/resolvers";
import path from "node:path";
import { proxy } from "./proxy";

export default defineConfig({
  plugins: [
    vue(),
    AutoImport({
      resolvers: [ArcoResolver()],
    }),
    Components({
      dts: true,
      resolvers: [
        ArcoResolver({
          sideEffect: true,
          importStyle: "less",
          resolveIcons: true,
        }),
      ],
    }),
  ],
  css: {
    preprocessorOptions: {
      less: {
        modifyVars: {
          // 主色调设置为#242424
          "arcoblue-6": "#242424",
          "arcoblue-5": "#2e2e2e", // 悬浮状态
          "arcoblue-7": "#1a1a1a", // 点击状态
          "arcoblue-4": "#3a3a3a", // 特殊场景
          "arcoblue-3": "#505050", // 一般禁用
          "arcoblue-2": "#727272", // 文字禁用
          "arcoblue-1": "#f0f0f0", // 浅色/白底悬浮
          // primary色值会自动从arcoblue映射
          "primary-6": "#242424",
        },
        javascriptEnabled: true,
      },
    },
  },
  resolve: {
    alias: {
      "@": path.resolve(__dirname, "./src"),
    },
  },
  server: {
    proxy,
    port: 2333,
  },
});
